package com.example.demoboot.service.impl;

import com.example.demoboot.bean.Test;
import com.example.demoboot.bean.User;
import com.example.demoboot.controller.CacheableDemo;
import com.example.demoboot.mapper.TestDao;
import com.example.demoboot.service.TestService;
import com.example.demoboot.utils.StringUtils;
import io.netty.util.internal.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
@Service
public class TestServiceImpl implements TestService {
    @Autowired
    private TestDao testDao;
    @Autowired
    CacheableDemo cacheableDemo;
    @Override
    public List<Test> getTest(String str) {
        User user = User.builder().name("aaa22").age(18).motto("bbb").build();
        System.out.println(cacheableDemo.fa("abc", user));
        List<Test> ss= testDao.findTest();
        return ss;
    }



    @Override
    @Cacheable(value="cache-name-one")
    public List<User> getTest2(User user) {

        List<User> users = new ArrayList<>();
        users.add(user);
        return users;
    }
}
